This code defines functions for managing Google Cloud Storage buckets, including listing existing buckets, creating new ones, and setting public access.
test create bucketThis code snippet is a unit test that verifies the functionality of a function designed to create a Google Cloud Storage bucket. It imports the function, sets up test parameters, calls the function, and asserts that a bucket was successfully created.
test stream to outputThis code defines a utility function called streamToOutput
that downloads a file from a URL or processes a stream and saves it to a local file. It handles directory creation and utilizes imported functions for file fetching and stream processing.
This code provides a utility function called fetchOrStream
that downloads a file from a URL or processes an existing stream, writing its content to a specified write stream. It handles both scenarios using a single function and returns a Promise for asynchronous execution.
This code provides a utility function called streamToGoogle
that uploads files or streams to a specified Google Cloud Storage bucket, handling bucket creation and metadata.
This code provides a function copyFileBucket
that copies a file within a Google Cloud Storage bucket, utilizing Google Cloud APIs for authentication and file manipulation.
This code tests the streamToGoogle
function, which uploads a file to Google Cloud Storage, by asserting that a valid URL is returned after the upload.